function get(id){return document.getElementById(id)};
function gDate(strInput,sNextD){
	if(get(strInput)) {
		get(strInput).onclick=function(){
			showCalendar(strInput,sNextD)
		};
	}
}
var shoubound = true;
function loadCalendarHtm(){}
function showCalendar(sFld1,sNextD,sCallback,sFld2)
{
	//1.sFld1取得日期的控件名称,
	//2.sNextD选取日期后新日历弹出从中取值的控件名称		
	//3.sCallback
	//4.sFld2,弹出日历默认日期
	var fld1,fld2;
	var cf=document.getElementById("CalFrame");
	if (cf!=null && cf!="undefine" && cf.src=="") 
	{		 
	    loadCalendarHtm = function(){showCalendar(sFld1,sNextD,sCallback,sFld2)};cf.src = "/js/calendar.htm";	   	    	
	    return;	    
	}	
	var wcf=window.frames.CalFrame;
	if(!sFld1){alert("输入控件未指定！");return;}
	fld1=document.getElementById(sFld1);
	if(!fld1){alert("输入控件不存在！");return;}
	if(fld1.tagName!="INPUT"||fld1.type!="text"){alert("输入控件类型错误！");return;}
	if(sFld2){fld2=document.getElementById(sFld2);if(!fld2){alert("参考控件不存在！");return;}if(fld2.tagName!="INPUT"||(fld2.type!="text"&&fld2.type!="hidden")){alert("参考控件类型错误！");return;}	}
	if(!wcf.bCalLoaded){alert("日历未成功装载！请刷新页面！");return;}
	wcf.n_textdate=sNextD;
	if(cf.style.display=="block"){cf.style.display="none";}
	if(!shoubound) { shoubound = false;}
	wcf.openbound=shoubound;
	wcf.fld1=fld1;
	wcf.fld2=fld2;
	wcf.callback=sCallback;
	wcf.initCalendar();
	var cfx = Array();
	cfx = get(sFld1+"_l").value.split(',');
	cf.style.top= cfx[1]+"px";
	cf.style.left= cfx[0]+"px";
	cf.style.display="block";
}
function hideCalendar(){var cf=document.getElementById("CalFrame");cf.style.display="none";}